<html xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:v="http://corejsf.com/validator">

<f:view>
<f:loadBundle var="text" basename="#{knowledgeForm.bundleName}"/>
    <head>
        <title>#{text['knowledgeDetail.title']}</title>
        <meta name="heading" content="#{text['knowledgeDetail.heading']}"/>
        <style type="text/css">
            .jscalendar-DB-div-style {
                position: absolute;
                margin-top: -120px;
                margin-left: -508px;
            }
    </style>
    </head>
<body id="knowledgeForm">

<h:form id="knowledgeForm" onsubmit="return validateKnowledgeForm(this)">
<h:inputHidden value="#{knowledgeForm.knowledge.id}" id="id"/>
<!-- IMPORTANT! Keep the version field as a hidden value to determine if this
is a new or existing entity -->
<h:inputHidden value="#{knowledgeForm.knowledge.version}" id="version"/>
<h:panelGrid columns="3">

    <h:outputLabel styleClass="desc" for="description" value="#{text['knowledge.description']}"/>
    <t:message for="description" styleClass="fieldError"/>
    <h:inputText styleClass="text medium" id="description" value="#{knowledgeForm.knowledge.description}" required="false" maxlength="255">
    </h:inputText>

    <h:outputLabel styleClass="desc" for="summary" value="#{text['knowledge.summary']}"/>
    <t:message for="summary" styleClass="fieldError"/>
    <h:inputText styleClass="text medium" id="summary" value="#{knowledgeForm.knowledge.summary}" required="true" maxlength="255">
        <v:commonsValidator type="required" arg="#{text['knowledge.summary']}"/>
    </h:inputText>

    <!-- todo: change this to read the identifier field from the other pojo -->
    <h:outputLabel styleClass="desc" for="user" value="#{text['knowledge.user']}"/>
    <t:message for="user" styleClass="fieldError"/>
    <h:selectOneMenu value="#{knowledgeForm.user_fk}" id="user" required="true" styleClass="select">
    	<f:selectItem itemValue=""/>
        <f:selectItems value="#{knowledgeForm.availableUsers}"/>
        <v:commonsValidator type="required" arg="#{text['knowledge.user']}"/>
    </h:selectOneMenu>
    
    <br/>
    <br/>

    <h:panelGroup styleClass="buttonBar bottom">
        <h:commandButton value="#{text['button.save']}" action="#{knowledgeForm.save}" id="save" styleClass="button"/>

        <c:if test="${not empty knowledgeForm.knowledge.id}">
        <h:commandButton value="#{text['button.delete']}" action="#{knowledgeForm.delete}"
            id="delete" styleClass="button"/> <!--  onclick="bCancel=true; return confirmDelete('Knowledge')" -->
        </c:if>

        <h:commandButton value="#{text['button.cancel']}" action="cancel" immediate="true"
            id="cancel" styleClass="button" onclick="bCancel=true"/>
    </h:panelGroup>
</h:panelGrid>
</h:form>

<v:validatorScript functionName="validateKnowledgeForm"/>

<script type="text/javascript">
//    Form.focusFirstElement($('knowledgeForm'));
    highlightFormElements();
</script>

</body>
</f:view>
</html>
